package com.zjitc.pigspring.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zjitc.pigspring.bean.po.EChartsVO;
import com.zjitc.pigspring.bean.po.Seller;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SellerMapper extends BaseMapper<Seller> {

    @Select("SELECT seller.name as name,SUM(goods.count) AS value FROM seller " +
            "JOIN goods ON seller.id = goods.seller_id GROUP BY seller.id,seller.name " +
            "ORDER BY value desc LIMIT 0,#{number}")
    List<EChartsVO> getTop(Integer number);
}
